//=============================================================================
// 文件名:   main.js
// 创建人:   han.zw
// 创建日期:  2016-04-15
// @:  hanangjie@163.com

require("!style!css!less!../../css/app.less")
var TODO = require("./todo")
import UNIT from "./unit"
//功能对象
function setScroll(){
    $(".sidebar").slimscroll({
        height: $(window).height() - $(".main-header").height() + "px",
        size: "3px",
        alwaysVisible: true
    })
}
$(function(){
    //左侧导航滚动
    setScroll();
    $(window).on("resize",setScroll);
    //左侧导航内容填充

    var Workspace = Backbone.Router.extend({
        routes: {
            "*actions" : "docDefaultRoute"
        },
        docDefaultRoute : function(actions){
            $("#sidebar-menu .treeview").find("li").removeClass("active");
            $("[href='#"+actions+"']").closest("li").addClass("active")
                .closest(".treeview").addClass("active")
            .find(".treeview-menu").show();
            try{
                UNIT.loading();
                eval("TODO."+actions+"()");
            }catch(e){
                UNIT.loadingClose();
                console.log("error:"+e);
            }
        }

    });
    var app_router = new Workspace;
    Backbone.history.start();

});


